layui.define(['form','table'], function(exports){
    var $ = layui.$,form = layui.form,table = layui.table;

    var goodsId =$('input[name="id"]').val();

    table.render({
        elem: '#LAY-table'
        ,url: layui.setter.webRoot + '/market/goods/space/list.data'
        ,where:{goodsId:goodsId}
        ,method: 'post'
        ,parseData: function (res) {
            return {
                "code": res.code,
                "msg": res.msg,
                "count": res.body.total,
                "data": res.body.data
            };
        }
        ,response: {statusCode: 200}
        ,size:'lg'
        ,cols: [[
            {field: 'id', width: 100, title: 'ID', sort: true}
            ,{field: 'name', title: '名称', minWidth: 100}
            ,{field: 'thumbnailImg', title: '规格图片', width: 100, templet: function (record){
                if(record.thumbnailImg){
                    return '<img style="display: inline-block; width: 100%; height: 100%;" src="'+record.thumbnailImg+'">';
                }else{
                    return '---';
                }
            }}
            ,{field: 'stockNum', title: '库存数'}
            ,{field: 'stateName',title: '状态'}
            ,{field: 'createDate', title: '创建时间', sort: true}
        ]]
        ,page: false
        ,height: 'full-220'
        ,text: '对不起，加载出现异常！'
    });

    exports('goods_info', {})
});